Fix husk -o/-j argument bounds check in batch command line#2658
Open
kikou wants to merge 1 commit into
Open
Conversation
The guard "i < commandLine.size() - 2" was off by one and dropped
the valid trailing pair (e.g. {"-o", "out.exr"} of size 2). It also
underflows when commandLine.size() < 2, since size() is unsigned.
Rewrote as "i + 1 < commandLine.size()" so the next-element access
is bounded correctly without unsigned underflow.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bounds-check bug in HdArnoldRenderDelegate::_SetRenderSetting when parsing Houdini/Solaris batchCommandLine render settings, preventing valid trailing -o <path> and -j/--threads <N> pairs from being ignored and avoiding potential out-of-bounds reads for short arrays.
Changes:
- Replace
i < commandLine.size() - 2guards withi + 1 < commandLine.size()for-oparsing. - Apply the same fix for
-j/--threadsparsing to prevent unsigned underflow and off-by-one behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HdArnoldRenderDelegate::_SetRenderSetting(batchCommandLine handling), the guardi < commandLine.size() - 2was off by one: with a valid trailing pair like{"-o", "out.exr"}(size 2,i = 0) the check is0 < 0and the override is silently dropped.commandLine.size()is unsigned, sosize() - 2also underflows whensize() < 2, which would makei < HUGEtrivially true and lead to an out-of-bounds access after++i.-oand-j/--threads) asi + 1 < commandLine.size()— same intent, no off-by-one, no unsigned underflow.Test plan
-o out.exrand confirm the output path override is applied.-j N/--threads Nand confirm thread count is set on the options node.